<template>
  <view class="my-settle-container">
    <!-- 全选 -->
    <label class="radio" @click="changeState">
      <radio color="#c00000" :checked="state" /><text>全选</text>
    </label>
    
    <!-- 合计区域 -->
    <view class="amount-box">
      合计:<text class="amount">￥{{totalMoney}}</text>
    </view>
    <!-- 结算按钮 -->
    <view class="btn-settle">结算({{checkedCount}})</view>
  </view>
</template>

<script>
  export default {
    name:"my-settle",
    props:{
      // 默认值在自己的组件中无法更改，需要通过外面传值的形式进行更改
      checkedCount:{
        type:Number,
        default:uni.$store.getters.checkCount
      },
      totalMoney:{
        type:Number,
        default:uni.$store.getters.totalMoney
      }
    },
    data() {
      return {
        // checkedTotal:uni.$store.getters.checkCount
        state:false
      };
    },
    methods:{
      changeState(){
        uni.$store._mutations.updateAllGoodsState[0](!this.state)
        this.state=!this.state
        this.$emit('is-all-choose')
      }
    }
  }
</script>

<style lang="scss">
.my-settle-container{
  position: fixed;
  bottom: 0;
  left: 0;
  height: 50px;
  width: 100%;
  background-color: #efefef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding-left: 5px;
}
.radio{
  display: flex;
  align-items: center;
}
.amount-box{
  .amount{
    color:#c00000;
    font-weight: bold;
  }
}
.btn-settle{
  background-color: #c00000;
  height: 50px;
  line-height: 50px;
  padding: 0 10px;
  min-width: 100px;
  text-align: center;
}
</style>